package lesson08

class Worker(){ //多例
  var id:String="123"
  def sayHello(): Unit ={

  }
}
object Worker {//单例
  var name:String="liudehua"
  def hello(): Unit ={

  }
}

object  Test{
  def main(args: Array[String]): Unit = {
    val w1 = new Worker()
    //在scala里面如果一个方法没有参数，调用这个方法的时候，括号可以省略。
    val worker = new Worker()
    println(w1)
    println(worker)
   // worker.sayHello
    val w2=Worker
    val w3=Worker

    println(w2)
    println(w3)



  }
}
